#include "widget.h"
#include "ui_widget.h"
#include<QShortcut>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->horizontalSlider->setValue(800);
    ui->horizontalSlider->setMaximum(1000);
    ui->horizontalSlider->setMinimum(300);
    ui->horizontalSlider->setSingleStep(1);
    QShortcut* q1 = new QShortcut(this);
    q1->setKey(QKeySequence("="));
    connect(q1,&QShortcut::activated,this,&Widget::handleh);

    ui->verticalSlider->setValue(600);
    ui->verticalSlider->setMaximum(1000);
    ui->verticalSlider->setMinimum(500);
    ui->verticalSlider->setSingleStep(1);
    ui->verticalSlider->setInvertedAppearance(true);
    QShortcut * q2 = new QShortcut(this);
    q2->setKey(QKeySequence("-"));
    connect(q2,&QShortcut::activated,this,&Widget::handldown);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleh()
{

    int value = ui->horizontalSlider->value();
   ui->horizontalSlider->setValue(value+20);

}

void Widget::handldown()
{
    int value = ui->horizontalSlider->value();
    ui->horizontalSlider->setValue(value-20);
}


void Widget::on_horizontalSlider_valueChanged(int value)
{
    QRect rect = this->geometry();

    this->setGeometry(rect.x(),rect.y(),value,rect.height());
}

void Widget::on_verticalSlider_valueChanged(int value)
{

    QRect rect = this->geometry();

    this->setGeometry(rect.x(),rect.y(),rect.width(),value);
}
